const app = getApp()

// pages/time/time.js
Page({

  /**
   * 页面的初始数据
   */
  data: {
    imgArr: [],
    arr: []
  },

  /**
   * 生命周期函数--监听页面加载
   */
  onLoad: function (options) {
    this.getBranch()
    this.getImg()
    // console.log(app.globalData.url);
  },
  // 携参数跳转
  goDetail(e) {
    let id = e.currentTarget.dataset.id
    wx.navigateTo({
      url: `/pages/schedule/schedule?id=${id}`,
    })
  },
  /**
   * 生命周期函数--监听页面初次渲染完成
   */
  onReady: function () {

  },
  // 获取分会场 
  getBranch() {
    let that = this
    wx.request({
      url: app.globalData.url + '/fyhs-meeting/app/meeting/listbranch/4',
      timeout: 3000,
      method: "GET",
      header: {
        'content-type': 'application/JSON'
      },
      success: function (res) {
        if (res.data.code === 0) {
          that.setData({
            arr: res.data.list
          })
        }
      },
      complete: function () {
        wx.hideNavigationBarLoading(); //完成停止加载图标
        wx.stopPullDownRefresh();
      }
    })
  },
  getImg() {
    let that = this
    wx.request({
      url: app.globalData.url + '/fyhs-meeting/app/advertise/listwithhost',
      timeout: 3000,
      method: "GET",
      header: {
        'content-type': 'application/JSON'
      },
      success: function (res) {
        if (res.data.code === 0) {
          that.setData({
            imgArr: res.data.list
          })
        }
      },
      complete: function () {
        wx.hideNavigationBarLoading(); //完成停止加载图标
        wx.stopPullDownRefresh();
      }
    })

  },

  /**
   * 生命周期函数--监听页面显示
   */
  onShow: function () {

  },

  /**
   * 生命周期函数--监听页面隐藏
   */
  onHide: function () {

  },

  /**
   * 生命周期函数--监听页面卸载
   */
  onUnload: function () {

  },

  /**
   * 页面相关事件处理函数--监听用户下拉动作
   */
  onPullDownRefresh: function () {
    let that = this
    that.getBranch()
    that.getImg()
    wx.showToast({
      title: "刷新成功",
      duration: 1500,
      mask:true
    })
    // console.log(123);
  },

  /**
   * 页面上拉触底事件的处理函数
   */
  onReachBottom: function () {

  },

  /**
   * 用户点击右上角分享
   */
  onShareAppMessage: function () {

  }
})